// src/store.js

import { createStore } from 'vuex'

const store = createStore({
    state() {
        return {
            token: null,
            user: null,     // 存储用户信息
            role: null      // 存储角色
        }
    },
    mutations: {
        setToken(state, token) {
            state.token = token
        },
        setUser(state, user) {
            state.user = user
        },
        setRole(state, role) {
            state.role = role
        }
    },
    actions: {},
    modules: {}
})

export default store